add_package()

py_library(
  NAME
    rewrite
  DEPS
    .analyze
    .frame
    .vm
)

py_library(
  NAME
    analyze
  SRCS
    analyze.py
  DEPS
    .context
    .vm
    pytype.config
    pytype.load_pytd
    pytype.pytd.pytd
)

py_test(
  NAME
    analyze_test
  SRCS
    analyze_test.py
  DEPS
    .analyze
    .context
    pytype.config
    pytype.load_pytd
    pytype.pytd.pytd
)

py_library(
  NAME
    context
  SRCS
    context.py
  DEPS
    .convert
    .load_abstract
    .output
    .pretty_printer
    pytype.config
    pytype.load_pytd
    pytype.errors.errors
)

py_library(
  NAME
    convert
  SRCS
    convert.py
  DEPS
    pytype.pytd.pytd
    pytype.rewrite.abstract.abstract
    pytype.rewrite.overlays.overlays
)

py_test(
  NAME
    convert_test
  SRCS
    convert_test.py
  DEPS
    pytype.pytd.pytd
    pytype.rewrite.abstract.abstract
    pytype.rewrite.tests.test_utils
)

py_library(
  NAME
    function_call_helper
  SRCS
    function_call_helper.py
  DEPS
    .context
    pytype.utils
    pytype.rewrite.abstract.abstract
    pytype.rewrite.flow.flow
    pytype.rewrite.overlays.overlays
)

py_test(
  NAME
    function_call_helper_test
  SRCS
    function_call_helper_test.py
  DEPS
    .frame
    pytype.rewrite.abstract.abstract
    pytype.rewrite.tests.test_utils
)

py_library(
  NAME
    frame
  SRCS
    frame.py
  DEPS
    .context
    .function_call_helper
    .operators
    .stack
    pytype.utils
    pytype.blocks.blocks
    pytype.rewrite.abstract.abstract
    pytype.rewrite.flow.flow
)

py_test(
  NAME
    frame_test
  SRCS
    frame_test.py
  DEPS
    .frame
    .operators
    pytype.pyc.pyc
    pytype.rewrite.abstract.abstract
    pytype.rewrite.tests.test_utils
)

py_library(
  NAME
    load_abstract
  SRCS
    load_abstract.py
  DEPS
    pytype.load_pytd
    pytype.pytd.pytd
    pytype.rewrite.abstract.abstract
)

py_test(
  NAME
    load_abstract_test
  SRCS
    load_abstract_test.py
  DEPS
    pytype.rewrite.abstract.abstract
    pytype.rewrite.flow.flow
    pytype.rewrite.tests.test_utils
)

py_library(
  NAME
    output
  SRCS
    output.py
  DEPS
    pytype.pytd.pytd
    pytype.rewrite.abstract.abstract
)

py_test(
  NAME
    output_test
  SRCS
    output_test.py
  DEPS
    .vm
    pytype.pytd.pytd
    pytype.rewrite.abstract.abstract
    pytype.rewrite.tests.test_utils
)

py_library(
  NAME
    operators
  SRCS
    operators.py
  DEPS
    pytype.pytd.pytd
    pytype.rewrite.abstract.abstract
    pytype.rewrite.flow.flow
)

py_test(
  NAME
    operators_test
  SRCS
    operators_test.py
  DEPS
    .operators
    pytype.rewrite.flow.flow
    pytype.rewrite.tests.test_utils
)

py_library(
  NAME
    pretty_printer
  SRCS
    pretty_printer.py
  DEPS
    pytype.pretty_printer_base
    pytype.pytd.pytd
    pytype.rewrite.flow.flow
    pytype.types.types
)

py_library(
  NAME
    stack
  SRCS
    stack.py
  DEPS
    pytype.rewrite.abstract.abstract
    pytype.rewrite.flow.flow
)

py_test(
  NAME
    stack_test
  SRCS
    stack_test.py
  DEPS
    .stack
    pytype.rewrite.tests.test_utils
)

py_library(
  NAME
    vm
  SRCS
    vm.py
  DEPS
    .context
    .frame
    pytype.config
    pytype.blocks.blocks
    pytype.pyc.pyc
    pytype.pytd.pytd
    pytype.rewrite.abstract.abstract
)

py_test(
  NAME
    vm_test
  SRCS
    vm_test.py
  DEPS
    .context
    .vm
    pytype.pyc.pyc
    pytype.rewrite.abstract.abstract
    pytype.rewrite.tests.test_utils
)

add_subdirectory(abstract)
add_subdirectory(flow)
add_subdirectory(overlays)
add_subdirectory(tests)
